import { IsTestingContext, datasetContext } from "./context";
import TestSettings from "./testSettings";
import TestMonitor from "./testMonitor";
import styles from "./styles.module.scss";
import { useEffect, useState } from "react";
import { getStatus } from "../../api";

function TestPage() {
  const [isTesting, setIsTesting] = useState(false);
  const [dataset, setDataset] = useState("RSOD");
  useEffect(() => {
    getStatus().then((status) => {
      setIsTesting(status === "TESTING");
    });
  });
  return (
    <div className={styles.content}>
      <IsTestingContext.Provider value={{ isTesting, setIsTesting }}>
        <datasetContext.Provider value={{ dataset, setDataset }}>
          <TestSettings></TestSettings>
          <TestMonitor></TestMonitor>
        </datasetContext.Provider>
      </IsTestingContext.Provider>
    </div>
  );
}

export default TestPage;
